package 数据结构.泛型类;

import java.util.List;

public class Glob {
    public void printList(List<?> list){
        for(Object o : list){
            System.out.println(o);
        }
    }
    public void  processUpperBound(List<? extends Number> list){
        for (Number number : list) {
            System.out.println(number);
        }
    }
    public void processLowerBound(List<? super Integer> list){
        list.add(10);//允许添加Integer类型
        for (Object obj : list) {
            System.out.println(obj);
        }
    }
    public void processList(List<String> list) {
        // list 的实际类型为 List<String> 在编译时会被擦除为 List<Object>
    }

}
